﻿using Decision.athen;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

public partial class DefaultMenu : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
        if (Session["userLogin"] == null)
        {
            Util.jsAlert(this.Page, "Session ของคุณหมดอายุ\nกรุณา Login อีกครั้ง");
            Util.jsRedirect(this.Page, "/Login.aspx?logout=true");
            return;
        }

        if (!IsPostBack)
        {
            RadMenuItem userInfo = (RadMenuItem)RadMenu1.FindItemByValue("UserInfo");
            userInfo.Text += " "+UserAthen.UserLogin.FNAME + " " + UserAthen.UserLogin.LNAME;

            RadMenuItem adminMenu = (RadMenuItem)RadMenu1.FindItemByValue("AdminMenu");
            adminMenu.Visible = UserAthen.UserLogin.USER_GROUP_LVL == 0;

            RadMenuItem managerMenu = (RadMenuItem)RadMenu1.FindItemByValue("Manager");
            managerMenu.Visible = UserAthen.UserLogin.USER_GROUP_LVL == 3 || UserAthen.UserLogin.USER_GROUP_LVL == 0;
        }
    }
    protected void RadMenu1_ItemClick(object sender, Telerik.Web.UI.RadMenuEventArgs e)
    {

    }
}